package com.iversonx.proxy.example_1.controller.v2;

import com.iversonx.proxy.example_1.domain.RequestInfo;
import com.iversonx.proxy.example_1.service.MetricsCollector;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Random;
import java.util.concurrent.TimeUnit;

/**
 *
 **/
@Component
class UserControllerV2 implements IUserController {
    private final Logger logger = LoggerFactory.getLogger(UserControllerV2.class);
    
    public void login() {
        logger.info("Start login()");
        // 模拟登录逻辑
        try {
            TimeUnit.SECONDS.sleep(new Random().nextInt(5));
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        logger.info("End login()");
    }
    
    public void register() {
        logger.info("Start register()");
        // 模拟登录逻辑
        try {
            TimeUnit.SECONDS.sleep(new Random().nextInt(5));
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        logger.info("End register()");
    }
}
